package com.pluszg.nutrition.common.resp;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;

@Getter
@Setter
@ToString
@AllArgsConstructor
public class CommonResponse<T> implements Serializable {

    private int retCode;

    private String retMsg;

    private T result;

    private static final String DEFAULT_MESSAGE = "SUCCESS";

    public CommonResponse() {
        this(null);
    }

    public CommonResponse(T result) {
        this(DEFAULT_MESSAGE, result);
    }

    public CommonResponse(int retCode, String retMsg) {
        this(retCode, retMsg, null);
    }

    public CommonResponse(String retMsg, T result) {
        this(ResponseCode.SUCCESS, retMsg, result);
    }
}
